//
//  THMineBabyHomeViewController.m
//  TreeHole
//
//  Created by apple on 2020/9/21.
//  Copyright © 2020 stoneobs. All rights reserved.
//

#import "THMineBabyHomeViewController.h"

#import "THBabySeriviceViewController.h"
#import "THBabyOrderViewController.h"
#import "THBabyInfoViewController.h"
#import "THApplyNewBabyInfoViewController.h"
@interface THMineBabyHomeViewController ()

@end

@implementation THMineBabyHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self stoneobs_fun_st_setRightItemWithTitle:@"申请更多" titleColor:STONEOBS_UI_THEME_BACKGROUNDCOLOR];
    [self stoneobs_fun_confiChildVC];
    [UITabBar appearance].translucent = YES;
    self.title = @"育婴师";
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:UIColor.blackColor,NSFontAttributeName:[UIFont boldSystemFontOfSize:17]}];
    self.navigationController.navigationBar.barTintColor =  UIColor.whiteColor;
    
    self.navigationController.navigationBar.translucent = NO;
    //关闭透明 带来的view 坐标下移
    self.extendedLayoutIncludesOpaqueBars = YES;
    self.rt_disableInteractivePop = NO;
     [self stoneobs_fun_st_setLeftItemWithImage:[UIImage imageNamed:@"icon_nav_back"]];
    // Do any additional setup after loading the view.
}
- (void)stoneobs_fun_st_rightBarAction:(id)sender{
    ({
        [THBabyTeacherDataController send_get_apply_ino_request:^(THApplyBabyTeacherModel * _Nonnull model) {

            THApplyNewBabyInfoViewController * vc = THApplyNewBabyInfoViewController.new;
//            vc.model = smodel;
            vc.apply_model = model;
            [self pushViewController:vc animated:1];

        }];
    });
}
//
- (BOOL)prefersStatusBarHidden
{
    
    return self.selectedViewController.prefersStatusBarHidden;
}

- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation
{
    return self.selectedViewController.preferredStatusBarUpdateAnimation;
}

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return self.selectedViewController.preferredStatusBarStyle;
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        
        self.tabBar.backgroundColor = UIColor.whiteColor;
        self.tabBar.barTintColor =  UIColor.whiteColor;
        [[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"Helvetica-Bold" size:11.f], NSForegroundColorAttributeName : UIColor.blackColor} forState:UIControlStateNormal];
        [[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName:STONEOBS_UI_THEME_BACKGROUNDCOLOR} forState:UIControlStateSelected];
        self.tabBar.backgroundImage = UIImage.new;
        [self.tabBar setShadowImage:UIImage.new];
    }
    return self;
}


- (void)stoneobs_fun_confiChildVC{
    
    
    
    [self stoneobs_fun_setTabbarChildController:[THBabySeriviceViewController new]
                                      itemTitle:@"服务"
                                      itemImage:[UIImage imageNamed:@"服务"]
                                    selectImage:[UIImage imageNamed:@"服务-s"]
                                        itemTag:10010];
    
    
    [self stoneobs_fun_setTabbarChildController:[THBabyOrderViewController new]
                                      itemTitle:@"订单"
                                      itemImage:[UIImage imageNamed:@"订单"]
                                    selectImage:[UIImage imageNamed:@"订单-s"]
                                        itemTag:10003];
    
    
    [self stoneobs_fun_setTabbarChildController:[THBabyInfoViewController new]
                                      itemTitle:@"资料"
                                      itemImage:[UIImage imageNamed:@"资料"]
                                    selectImage:[UIImage imageNamed:@"资料-s"]
                                        itemTag:10003];
    
    
}

- (void)stoneobs_fun_setTabbarChildController:(UIViewController *)controller itemTitle:(NSString *)title itemImage:(UIImage *)image selectImage:(UIImage *)simage itemTag:(NSInteger)tag {
    
    
    simage = [simage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    controller.tabBarItem = [[UITabBarItem alloc] initWithTitle:title image:image selectedImage:simage];
    controller.tabBarItem.tag = tag;
    [self addChildViewController:controller];
}
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
    self.tabBar.hidden = NO;
}
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
    return  YES;
}

@end
